package com.itserver.service.sysUtils.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itserver.mapper.sysUtils.FormCreateMapper;
import com.itserver.pojo.PageResult;
import com.itserver.pojo.sysUtils.FormItem;
import com.itserver.pojo.sysUtils.QueryFormItem;
import com.itserver.service.sysUtils.FormCreateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public  class FormCreateServiceImpl implements FormCreateService {
    @Autowired
    private FormCreateMapper formCreateMapper;
    @Override
    public PageResult<FormItem> list(QueryFormItem queryFormItem) {
        PageHelper.startPage(queryFormItem.getPage(), queryFormItem.getPageSize());
        List<FormItem> list = formCreateMapper.list(queryFormItem);
        Page<FormItem> page = (Page<FormItem>) list;
        return new PageResult<>(page.getTotal(), page.getResult());
    }
    @Override
    public void add(FormItem formItem) {
        formCreateMapper.add(formItem);
    }

    @Override
    public void update(FormItem formItem) {
        formCreateMapper.update(formItem);
    }

    @Override
    public void delete(List<Integer> ids) {
        formCreateMapper.delete(ids);
    }

    @Override
    public FormItem getById(Object formId) {
        return formCreateMapper.getById(formId);
    }
}

